package com.bh.order.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bh.common.core.text.Convert;
import com.bh.order.domain.JcLedShipment;
import com.bh.order.mapper.JcLedShipmentMapper;
import com.bh.order.service.IJcLedShipmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 分段订单运单关联Service业务层处理
 *
 * @author slx
 * @date 2023-04-24
 */

@Service
public class JcLedShipmentServiceImpl extends ServiceImpl<JcLedShipmentMapper, JcLedShipment> implements IJcLedShipmentService {
    @Autowired
    private JcLedShipmentMapper jcLedShipmentMapper;

    /**
     * 查询分段订单运单关联
     *
     * @param jcShipmentId 分段订单运单关联主键
     * @return 分段订单运单关联
     */
    @Override
    public JcLedShipment selectJcLedShipmentByJcShipmentId(Long jcShipmentId) {
        return jcLedShipmentMapper.selectById(jcShipmentId);
    }

    /**
     * 查询分段订单运单关联列表
     *
     * @param jcLedShipment 分段订单运单关联
     * @return 分段订单运单关联
     */
    @Override
    public List<JcLedShipment> selectJcLedShipmentList(JcLedShipment jcLedShipment) {
        return jcLedShipmentMapper.selectJcLedShipmentList(jcLedShipment);
    }

    /**
     * 新增分段订单运单关联
     *
     * @param jcLedShipment 分段订单运单关联
     * @return 结果
     */
    @Override
    public int insertJcLedShipment(JcLedShipment jcLedShipment) {
        return jcLedShipmentMapper.insert(jcLedShipment);
    }

    /**
     * 修改分段订单运单关联
     *
     * @param jcLedShipment 分段订单运单关联
     * @return 结果
     */
    @Override
    public int updateJcLedShipment(JcLedShipment jcLedShipment) {
        return jcLedShipmentMapper.updateById(jcLedShipment);
    }

    /**
     * 批量删除分段订单运单关联
     *
     * @param jcShipmentIds 需要删除的分段订单运单关联主键
     * @return 结果
     */
    @Override
    public int deleteJcLedShipmentByJcShipmentIds(String jcShipmentIds) {
        return jcLedShipmentMapper.deleteBatchIds(Arrays.asList(Convert.toStrArray(jcShipmentIds)));
    }

    /**
     * 删除分段订单运单关联信息
     *
     * @param jcShipmentId 分段订单运单关联主键
     * @return 结果
     */
    @Override
    public int deleteJcLedShipmentByJcShipmentId(Long jcShipmentId) {
        return jcLedShipmentMapper.deleteById(jcShipmentId);
    }
}
